FBlockAllocator provides a simple allocator that works on larger blocks of memory. More...
#include <fmemory.h>
Public Member Functions | |
FBlockAllocator (uint32 blockSize) | |
Constructor. | |
~FBlockAllocator () | |
Destructor. Releases allocated memory back to the heap. | |
void * | allocate (uint32 size) |
allocate memory from within a preallocated memory block. If size is larger than blockSize, blockSize is increased in multiples of 2. | |
void | free (void *p) |
free memory allocated with allocate() | |
Protected Attributes | |
TArray< Block > | blocks |
uint32 | blockSize |
FLock | lock |
FBlockAllocator provides a simple allocator that works on larger blocks of memory.
FBlockAllocator is used to allocate chunks of memory that are placed in larger memory blocks.
Memory is not released to the heap until the destructor of FBlockAllocator.
FBlockAllocator is thread safe, as it uses FLock to synchronize modifications.
FBlockAllocator | ( | uint32 | blockSize | ) |
Constructor.
[in] | blockSize | : size of the memory blocks, that provide space for smaller allocations |
~FBlockAllocator | ( | ) |
Destructor. Releases allocated memory back to the heap.
void * allocate | ( | uint32 | size | ) |
allocate memory from within a preallocated memory block. If size is larger than blockSize, blockSize is increased in multiples of 2.
void free | ( | void * | p | ) |
free memory allocated with allocate()
uint32 blockSize [protected] |